package com.fixme4trade.view;

import javax.inject.Inject;

import br.gov.frameworkdemoiselle.annotation.PreviousView;
import br.gov.frameworkdemoiselle.stereotype.ViewController;
import br.gov.frameworkdemoiselle.template.AbstractEditPageBean;
import br.gov.frameworkdemoiselle.transaction.Transactional;
import com.fixme4trade.business.ForumBC;
import com.fixme4trade.domain.Forum;

@ViewController
@PreviousView("/forum_list.xhtml")
public class ForumEditMB extends AbstractEditPageBean<Forum, Long> {

	private static final long serialVersionUID = 1L;

	@Inject
	private ForumBC bc;

	@Override
	@Transactional
	public String delete() {
		this.bc.delete(getId());
		return getPreviousView();
	}

	@Override
	@Transactional
	public String insert() {
		this.bc.insert(getBean());
		return getPreviousView();
	}

	@Override
	@Transactional
	public String update() {
		this.bc.update(getBean());
		return getPreviousView();
	}

	@Override
	protected void handleLoad() {
		setBean(this.bc.load(getId()));
	}
	
	

}
